home *** CD-ROM | disk | FTP | other *** search
- Path: rac1.wam.umd.edu!kwhite
- From: Brainman <kwhite@wam.umd.edu>
- Newsgroups: comp.lang.c
- Subject: 32 bit int binary file port
- Date: Mon, 11 Mar 1996 21:39:14 -0500
- Organization: University of Maryland College Park
- Message-ID: <Pine.ULT.3.91.960311211827.5811A-100000@rac1.wam.umd.edu>
- NNTP-Posting-Host: rac1.wam.umd.edu
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
-
-
- Hey all,
-
- In the process of upgrading Borland 4.52 to the "PowerPack" 32bit DOS
- extenders, I have discovered that sizeof(int) in 32 bit protected mode
- is now 4 instead of 2.
-
- The problem is that I need to read in several huge (4Meg+) binary
- files of ints that were construced as 2 byte chunks. Because these
- files are so huge, I'd rather not have to do any massively sophisticated
- bit shifting on each 2-byte word, if possible (if I read the entire file
- in with fread in 64K chunks of 1 byte, I can get the values into memory
- pretty quickly -- I suspect that I'd suffer a huge performance hit
- by converting the ints one at a time).
-
- Is there a standard function or algorithm on 32 bit platforms to read two
- bytes and make them 4 byte "ints" after the fact, as it were?
-
- Any help is much appreciated.
-
- Kenn White
- kwhite@wam.umd.edu
- white@baldr.niaaa.nih.gov
-
-
-